package com.black.pay.vo;

import com.alibaba.fastjson.JSONObject;

public class R extends JSONObject {
    private R() {
    }

    public static R ok(){

        R r = new R();
        r.put("code", 0);
        r.put("msg", "success");
        return r;
    }

    public static R fail(){
        R r = new R();
        r.put("code", 500);
        r.put("msg", "fail");
        return r;
    }

    public static R error401(){
        R r = new R();
        r.put("code", 401);
        r.put("msg", "请先登陆");
        return r;
    }

    public static R fail(String msg){
        R r = new R();
        r.put("code", 500);
        r.put("msg", msg);
        return r;
    }

    @Override
    public String toString() {
        return this.toJSONString();
    }

    public R put(String key, Object obj) {
        super.put(key,obj);
        return this;
    }
}
